第21天了,庫存筆記在前幾天清得差不多,進入划水模式。這一題是客戶IT的詢問,發揮IT第三人的本色達成。
客戶需求是:
% podman images | grep -v TAG
docker.io/ibmcom/websphere-traditional latest 58644023c853 4 weeks ago 1.93 GB
docker.io/dokken/rockylinux-9 latest 702f9f0841d2 3 months ago 422 MB
docker.io/dokken/centos-8 latest 3fd0965b46cc 3 months ago 608 MB
docker.io/library/openjdk 8-jdk-alpine a3562aa0b991 5 years ago 106 MB
希望透過指令,輸出如下內容:
centos-8 docker.io/dokken/centos-8:latest
所以委託ChatGPT協助:
podman images | grep -v TAG | awk '{print $1":"$2}' | sed 's/.*\/\([^\/:]*\):.*/\1 &/'
輸出結果如下:
websphere-traditional docker.io/ibmcom/websphere-traditional:latest
rockylinux-9 docker.io/dokken/rockylinux-9:latest
centos-8 docker.io/dokken/centos-8:latest
openjdk docker.io/library/openjdk:8-jdk-alpine